﻿using HandyControl.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ZoneLinePacking.Common;
using ZoneLinePacking.Core.Extensions;

namespace ZoneLinePacking.Controls {
    /// <summary>
    /// NonClientAreaControl.xaml 的交互逻辑
    /// </summary>
    public partial class NonClientAreaControl : UserControl {
        public NonClientAreaControl() {
            InitializeComponent();
        }

        private void ButtonLangs_OnClick(object sender, RoutedEventArgs e) {
            //if (e.OriginalSource is Button btn) {
            //    string langName = btn.Tag.ToString();
            //    PopupConfig.IsOpen = false;
            //    if (langName.Equals(AppSession.Config.Lang)) {
            //        return;
            //    }
            //    AppSession.Config.Lang = langName;
            //    AppSession.SaveAppConfig();
            //    ((App)Application.Current).UpdateLang(langName);
            //}
        }

        private void ButtonConfig_OnClick(object sender, RoutedEventArgs e) => PopupConfig.IsOpen = true;

        private void ButtonSkins_OnClick(object sender, RoutedEventArgs e) {
            if (e.OriginalSource is Button btn) {
                SkinType skinType = (SkinType)btn.Tag;
                PopupConfig.IsOpen = false;
                if (skinType.Equals(AppSession.Config.Skin)) {
                    return;
                }

                AppSession.Config.Skin = skinType;
                AppSession.SaveAppConfig();
                ((App)Application.Current).UpdateSkin(skinType);
            }
        }

        private void MenuAbout_OnClick(object sender, RoutedEventArgs e) {
            //new AboutWindow {
            //    Owner = Application.Current.MainWindow
            //}.ShowDialog();
        }
    }
}
